﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using University.Workshop.Presentation.ControlWPF.TransitionControl;
using University.Workshop.Presenters.Square.Register;

namespace University.Workshop.Presentation.Square.Register
{
    /// <summary>
    /// Interaction logic for PageRegisterView.xaml
    /// </summary>
    public partial class PageRegisterView : Page, IRegisterNewSquareView
    {
        PresenterRegisterNewSquare pRegisterNewSquare;
        public PageRegisterView()
        {
            InitializeComponent();
            pRegisterNewSquare = new PresenterRegisterNewSquare(this);
        }

        private void GoStepOne_Click(object sender, RoutedEventArgs e)
        {
            pRegisterNewSquare.GoStepOne();
        }

        private void GoStepTwo_Click(object sender, RoutedEventArgs e)
        {
            pRegisterNewSquare.GoStepTwo();
        }

        private void btnCancelRegister_Click(object sender, RoutedEventArgs e)
        {
            RestartRegisterSquare();
        }

        private void btnRegisterMedicine_Click(object sender, RoutedEventArgs e)
        {
            pRegisterNewSquare.RegisterSquare();
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            pRegisterNewSquare.GoBackPage();
        }

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {

            pRegisterNewSquare.GoNextPage();
        }
        

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {        
            pRegisterNewSquare.FirstTime();
        }

        public void CallSecondPage()
        {
            PageSecondStepRegisterSquare pp = new PageSecondStepRegisterSquare(pRegisterNewSquare);
            RegisterBasic = pp;

            frmContent.Navigate(pp);
            GoStepTwo.IsEnabled = true;
        }

        public void CallFirstPage()
        {
            PageFirstStepRegisterSquare pp = new PageFirstStepRegisterSquare(pRegisterNewSquare);
            RegisterBasic = pp;
            frmContent.Navigate(pp);
        }

        public IRegisterSquareBasicView RegisterBasic
        {
            get;
            set;
        }
        public void SystemMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Atencion!!!", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }

        public void ErrorMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Error!!!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }                                                                                                                                                                                                                                                                                                                                                                                                                                      

        public void RestartRegisterSquare()
        {
            this.NavigationService.Navigate(new PageRegisterView());
        }
    }
}
